package com.hoppinzq.service;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.springframework.stereotype.Service;

@Service
public class MyService {
    private final WebDriver webDriver;
    public MyService(WebDriver webDriver) {
        this.webDriver = webDriver;
    }
    public void performAutomation() {
        // 使用WebDriver执行自动化操作
        webDriver.get("https://www.google.com");
        WebElement searchBox = webDriver.findElement(By.name("q"));
        searchBox.sendKeys("Selenium");
        searchBox.submit();
    }
}